package com.slz3.business.module.drawManagement.draFreeLottery.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.drawManagement.draFreeLottery.domain.DraFreeLottery;
import com.slz3.business.module.drawManagement.draFreeLottery.domain.DraFreeLotteryCondition;
import com.slz3.business.module.drawManagement.draIntegralLottery.domain.DraIntegralLotteryCondition;
import com.slz3.business.module.drawManagement.draIntegralLottery.steward.DraIntegralLotteryResUnsafeValid;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class DraFreeLotteryResController {

    @Resource
    private DraFreeLotteryResAtomic draFreeLotteryResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, DraFreeLottery draFreeLottery) {
        if (DraFreeLotteryResUnsafeValid.add(req, draFreeLottery)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.add_$DraFreeLotteryUpdateLock(req, draFreeLottery);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, DraFreeLotteryCondition draFreeLotteryCondition) {
        if (DraFreeLotteryResUnsafeValid.delete(req, draFreeLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.delete_$DraFreeLotteryUpdateLock(req, draFreeLotteryCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, DraFreeLottery draFreeLottery) {
        if (DraFreeLotteryResUnsafeValid.modify(req, draFreeLottery)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.modify_$DraFreeLotteryUpdateLock(req, draFreeLottery);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (DraFreeLotteryResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return DraFreeLotteryResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return draFreeLotteryResAtomic.info_$DraFreeLotteryUpdateLock(req);
        if (DraFreeLotteryResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.info_$DraFreeLotteryUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (DraFreeLotteryResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return DraFreeLotteryResExecutor.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, DraFreeLotteryCondition draFreeLotteryCondition) {
        //
        if (DraFreeLotteryResUnsafeValid.auditSubmit(req, draFreeLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.auditSubmit_$DraFreeLotteryUpdateLock(req, draFreeLotteryCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, DraFreeLotteryCondition draFreeLotteryCondition) {
        if (DraFreeLotteryResUnsafeValid.audit(req, draFreeLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.audit_$DraFreeLotteryUpdateLock(req, draFreeLotteryCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, DraFreeLotteryCondition draFreeLotteryCondition) {
        if (DraFreeLotteryResUnsafeValid.auditReject(req, draFreeLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.auditReject_$DraFreeLotteryUpdateLock(req, draFreeLotteryCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, DraFreeLotteryCondition draFreeLotteryCondition) {
        if (DraFreeLotteryResUnsafeValid.usingEnable(req, draFreeLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.usingEnable_$DraFreeLotteryUpdateLock(req, draFreeLotteryCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, DraFreeLotteryCondition draFreeLotteryCondition) {
        if (DraFreeLotteryResUnsafeValid.usingDisable(req, draFreeLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.usingDisable_$DraFreeLotteryUpdateLock(req, draFreeLotteryCondition);
        }
    }
    public Mono<? extends ServerResponse> lottery(ServerRequest req, DraFreeLotteryCondition draFreeLotteryCondition) {
        if (DraFreeLotteryResUnsafeValid.lottery(req, draFreeLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draFreeLotteryResAtomic.lottery_$DraFreeLotteryUpdateLock(req, draFreeLotteryCondition);
        }
    }


}
